<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title></title>
    <th:block th:include="statics/common/page/header"></th:block>
</head>
<body>
<div id="orgPosition" v-cloak>
    <div v-show="showList">
        <Row class="search-panel-space">
            <div class="search-group">
                <i-col span="5">
                    <label class="search-label-20">职位名称:</label>
                    <i-input v-model="q.name" @on-enter="query" placeholder="名称" class="search-item-width-75"/>
                </i-col>
            	<i-col span="5">
                	<label class="search-label-20">公司名称:</label>
                    <i-input v-model="q.companyName" @on-enter="query" placeholder="名称" class="search-item-width-75"/>
                </i-col>
                <i-col span="5">
                	<label class="search-label-20">部门名称:</label>
                    <i-input v-model="q.departmentName" @on-enter="query" placeholder="名称" class="search-item-width-75"/>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
            <div class="buttons-group">
                <i-button type="info" @click="add" th:if="${@shiroAuthService.hasPermission('orgposition:save')}">
                    <i class="fa fa-plus"></i>&nbsp;新增
                </i-button>
                <i-button type="warning" @click="update"
                          th:if="${@shiroAuthService.hasPermission('orgposition:update')}">
                    <i class="fa fa-pencil-square-o"></i>&nbsp;修改
                </i-button>
                <i-button type="error" @click="del" th:if="${@shiroAuthService.hasPermission('orgposition:delete')}">
                    <i class="fa fa-trash-o"></i>&nbsp;删除
                </i-button>
            </div>
        </Row>
        <table id="orgPositionGrid"></table>
    </div>

    <Card v-show="!showList">
        <p slot="title" style="height: 35px;">{{title}}
            <i-button type="warning" @click="reload" style="margin-right: 8px;float: right;"/>返回</i-button></p>
        <i-form ref="formValidate" :model="orgPosition" :rules="ruleValidate" :label-width="80">
            <Form-item label="所属公司" prop="companyId" style="width: 450px;">
                <i-input v-model="orgPosition.companyName" placeholder="所属公司"
                         icon="eye" readonly="readonly" @on-click="deptTree"/>
            </Form-item>
            <Form-item label="所属部门" prop="departmentId" style="width: 450px;">
                <i-select v-model="orgPosition.departmentId" id="orgPosition_departmentId">
                    <i-option v-for="depart in departmentList" :value="depart.id" :key="depart.id" >
                        {{depart.name}}
                    </i-option>
                </i-select>
            </Form-item>
            <Form-item label="职位名称" prop="name" style="width: 450px;">
            	<i-input v-model="orgPosition.name" placeholder="职位名称"/>
                <!-- <i-select v-model="orgPosition.name" @on-query-change="queryPositionList" style="width: 320px;" filterable>
                    <i-option v-for="position in positionList" :value="position.dictKey" :key="position.dictKey">
                        {{position.dictValue}}
                    </i-option>
                </i-select> -->
            </Form-item>
            <Form-item label="排序" prop="orderNum" style="width: 450px;">
                <i-input v-model="orgPosition.orderNum" placeholder="排序"/>
            </Form-item>
            <Form-item label="职位描述" prop="description" style="width: 450px;">
                <i-input v-model="orgPosition.description" placeholder="职位描述" type="textarea"
                         :autosize="{minRows:3,maxRows:7}"/>
            </Form-item>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
</div>

<!-- 选择公司 -->
<div id="orgCompanyLayer" style="display: none;padding:10px;">
    <ul id="orgCompanyTree" class="ztree"></ul>
</div>

<script th:src="@{../statics/js/org/position.js}"></script>
</body>
</html>